﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>跟进历史</title>
    <#include "../common/link.ftl" >
    <script type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>`
    <script>
        $(function () {
            $(".btn-input").click(function () {

                //弹出模态框
                $("#editModal").modal("show");
                //修改模态框标题
                $("#inputTitle").html("跟进历史");
                //数据复原
                $("#editForm")[0].reset();

                //客户回显数据
                var json = $(this).data("json");
                console.log(json)
                if(json){
                    $("#editForm input[name='id']").val(json.id);
                    $("#editForm input[name='traceTime']").val(json.traceTime);
                    $("#editForm input[name='traceDetails']").val(json.traceDetails);
                    $("#editForm select[name='traceTypeId']").val(json.traceTypeId);
                    $("#editForm select[name='traceResult']").val(json.traceResult);
                    $("#editForm input[name='customerId']").val(json.customerId);
                    $("#editForm input[name='name']").val(json.customerName);
                }
            })
            $(".inputSubmit").click(function () {
                $("#editForm").ajaxSubmit(function (data) {
                    if(data.success){
                        window.location.reload();
                    }else{
                        $.messager.alert("温馨提示", data.msg)
                    }
                })
            })
        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl" >
    <!--菜单回显-->
    <#assign currentMenu="customertracehistory"/>
    <#include "../common/menu.ftl" >
    <div class="content-wrapper">
        <section class="content-header">
            <h1>跟进历史管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/customerTraceHistory/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <div class="form-group">
                        <label for="keyword">关键字:</label>
                        <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!''}" placeholder="请输入姓名/电话">
                    </div>
                    <div class="form-group">
                        <label for="seller">跟进类型:</label>
                        <select class="form-control" id="type" name="typeId">
                            <option value="-1">全部</option>
                            <option value="0">潜在客户</option>
                            <option value="1">正式客户</option>
                            <option value="2">客户池</option>
                            <option value="3">失败客户</option>
                            <option value="4">流失客户</option>
                        </select>
                        <script>
                            $("#type option[value='${qo.typeId}']").prop("selected", true);
                        </script>
                    </div>
                    <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                </form>
                <#--<form class="form-inline" id="searchForm" action="/customerTraceHistory/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    &lt;#&ndash;<a href="/systemDictionary/input.do" class="btn btn-success btn-input" style="margin: 10px">
                        <span class="glyphicon glyphicon-plus"></span> 添加
                    </a>&ndash;&gt;
                </form>-->
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>姓名</th>
                            <th>跟进日期</th>
                            <th>跟进内容</th>
                            <th>跟进方式</th>
                            <th>跟进结果</th>
                            <th>录入人</th>
                            <th>跟进类型</th>
                            <th></th>
                        </tr>
                        <#list result.list as entity>
                            <tr>
                                <td>${entity_index+1}</td>
                                <td>${entity.customer.name!}</td>
                                <td>${entity.traceTime!}</td>
                                <td>${entity.traceDetails!}</td>
                                <td>${entity.systemDictionaryItem.title!}</td>
                                <td>${entity.displayTraceResult!}</td>
                                <td>${entity.inputUser.name!}</td>
                                <td>${entity.displayStatus!}</td>
                                <td>
                                    <a href="#" class="btn btn-info btn-xs btn-input"  data-json='${entity.jsonString}'>
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>
                                </td>
                            </tr>
                        </#list>
                    </table>
                    <!--分页-->
                    <#include "../common/page.ftl">
                    <div style="text-align: center;">
                     <ul id="pagination-demo" class="pagination-sm"></ul>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl" >
</div>

<#--客户编辑模态框-->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title inputTitle">跟进历史编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/customerTraceHistory/saveOrUpdate.do" method="post" id="editForm">
                    <input type="hidden" name="id">
                    <input type="hidden" name="customerId">
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">客户姓名：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" readonly name="name"/>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">跟进时间：</label>
                        <div class="col-lg-6 ">
                            <input type="text" class="form-control "  name="traceTime" onfocus="WdatePicker()" placeholder="请输入跟进时间">
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">跟进记录：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" name="traceDetails"
                                   placeholder="请输入跟进记录"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">交流方式：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="traceTypeId">
                                <#list ccts! as c>
                                    <option value="${c.id}">${c.title}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">跟进结果：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="traceResult">
                                <option value="3">优</option>
                                <option value="2">中</option>
                                <option value="1">差</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">备注：</label>
                        <div class="col-lg-6">
                            <textarea type="text" class="form-control" name="remark"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary inputSubmit" >保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
